import requests
import json

jenkins_url = "http://your-jenkins-server"
username = "your-username"
api_token = "your-api-token"

auth = (username, api_token)

for i in range(1, 11):
    job_name = f"Job-{i}"
    config_xml = f"""<project>
        <description>This is job number {i}</description>
        <builders>
            <hudson.tasks.Shell>
                <command>echo 'Hello from Job {i}'</command>
            </hudson.tasks.Shell>
        </builders>
    </project>"""

    response = requests.post(
        f"{jenkins_url}/createItem?name={job_name}",
        auth=auth,
        headers={"Content-Type": "application/xml"},
        data=config_xml
    )

    if response.status_code == 200:
        print(f"Job {job_name} created successfully.")
    else:
        print(f"Failed to create job {job_name}. Status code: {response.status_code}")